package trunk.backend;

import java.util.ArrayList;

public class HTMLRadioButton extends HTMLElement {
	private String name;
	private ArrayList<String> labels;
	private ArrayList<String> values;
	private boolean vertical;
	
	public HTMLRadioButton(String name, ArrayList<String> labels, ArrayList<String> values, boolean vertical) {
		this.name = new String(name);
		this.labels = new ArrayList<String>(labels);
		this.values = new ArrayList<String>(values);
		this.vertical = vertical;
	}
	
	public String toHTML() {
		String radioButtons = "";
		for (int i = 0; i < labels.size(); i++) {
			radioButtons += "<input type=\"radio\" name=" + name + "\" ";
			radioButtons += "value=\"" + values.get(i) + "\" /> " + labels.get(i) + "\n";
			if (vertical) radioButtons += "<br />\n";
		}
		return radioButtons;
	}
}
